<?php

namespace app\admin\model\episode;

use think\Model;


class Script extends Model
{

    

    

    // 表名
    protected $name = 'episode_script';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [

    ];
    

    protected static function init()
    {
        self::afterInsert(function ($row) {
            $pk = $row->getPk();
            $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
        });
    }

    
    public function getTypeList()
    {
        return ['1' => __('Type 1'), '2' => __('Type 2')];
    }
    
    public function getVideoTypeList()
    {
        return ['1' => __('Video_type 1'), '2' => __('Video_type 2')];
    }
    
    
    public function getImageTypeList()
    {
        return ['1' => __('Image_type 1'), '2' => __('Image_type 2')];
    }


    public function getStatusList()
    {
        return ['1' => __('Status 1'), '2' => __('Status 2'), '3' => __('Status 3')];
    }

    public function getIsBannerList()
    {
        return ['1' => __('Is_banner 1'), '2' => __('Is_banner 2')];
    }



    public function producer()
    {
        return $this->belongsTo('Producer', 'episode_producer_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
